package com.third.customer.model.data;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * Created by hehuaichun on 2020/5/19.
 */
@AllArgsConstructor
@Getter
public enum UserType {

    ADMIN((byte) 0, "管理员"),

    ORDINARY((byte) 1, "普通用户");

    private byte code;

    private String name;

    public static UserType codeOf(byte code){
        for(UserType userType : UserType.values()){
            if(code == userType.getCode()){
                return userType;
            }
        }
        return null;
    }

}
